package com.example.dao;

import com.example.domain.Like;
import org.apache.ibatis.annotations.*;
//点赞数据操作
public interface LikeMapper {
    @Insert("INSERT INTO `like` (user_id, post_id, comment_id, create_time) VALUES (#{userId}, #{postId}, #{commentId}, #{createTime})")
    void save(Like like);

    @Select("SELECT COUNT(*) FROM `like` WHERE post_id = #{postId}")
    int countByPostId(Integer postId);

    @Select("SELECT COUNT(*) FROM `like` WHERE comment_id = #{commentId}")
    int countByCommentId(Integer commentId);
}